﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PluginXtraZone
{
    public partial class frmTokenHandler : Form
    {
        public string Token { get; private set; }

        public frmTokenHandler()
        {
            InitializeComponent();
            Token = "";
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            Login();
        }

        private void tbToken_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                Login();
            }
        }

        private void Login()
        {
            if (tbToken.Text != string.Empty)
            {
                Token = tbToken.Text;
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                lblError.Text = ("Insert a token please!");
            }
        }
    }
}
